package org.nanotek.lucene.index;

import java.io.File;

import org.apache.lucene.document.Document;
import org.apache.lucene.index.IndexWriter;
import org.nanotek.lucene.beans.DocumentBuilder;

public abstract class DocumentIndexer {

	protected IndexWriter indexWriter;
	
	public void indexDocs (DocumentBuilder configurer, File file) throws Exception 
	{ 

		indexWriter = configurer.configureIndexWriter(); 

	}

	public void indexDocs(IndexWriter writer) throws Exception {
		Document document = createTemplate();
		writer.addDocument(document);
	}

	public  abstract Document createTemplate() throws Exception;

	public IndexWriter getIndexWriter() {
		return indexWriter;
	}

	public void setIndexWriter(IndexWriter indexWriter) {
		this.indexWriter = indexWriter;
	}

}
